Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add using skipClient.balances #259

Merged
merged 20 commits into from
Sep 20, 2024
Merged

Add using skipClient.balances #259

merged 20 commits into from
Sep 20, 2024

Conversation

toddkao
Copy link
Collaborator

@toddkao toddkao commented Sep 18, 2024

Add using skipClient.balances
Use devApiUrl
Fix invertSwapAtom logic
Add EVM warning

Widget.-.Widget.Storybook.-.19.September.2024.mp4

Ensure that debouncing still works when inverting source/dest

Widget.-.Widget.Storybook.-.19.September.2024.1.mp4

Screenshot 2024-09-19 at 3 37 37 PM

Copy link

changeset-bot bot commented Sep 18, 2024

⚠️ No Changeset found

Latest commit: afaa296

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
widget-nextjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 3:08pm

@toddkao toddkao changed the title WIP balances Add using skipClient.balances Sep 18, 2024
Copy link
Member

@codingki codingki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we limit digits after comma to 4 for the balance

import { BigNumber } from "bignumber.js";


const ETH_GAS_FEE = 0.1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 0.01 or 10 * 10 ** 16

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's a little easier to understand if we keep the value in terms of how much ETH and then convert it to the tokenAmount using a util like this:

convertHumanReadableAmountToCryptoAmount(ETH_GAS_FEE)

but I do need to pass the correct decimals which i forgot to do


switch (chainType) {
case "evm":
return Number(convertHumanReadableAmountToCryptoAmount(ETH_GAS_FEE));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to pass decimals from source details, we are not sure every evm native asset is 18 decimals

Copy link
Collaborator Author

@toddkao toddkao Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codingki gotcha so we are always subtracting 0.01 of the source asset from the max to make space for gas

@toddkao toddkao merged commit daf3781 into main Sep 20, 2024
6 checks passed
@toddkao toddkao deleted the v2-balances branch September 20, 2024 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants